using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace WebDauGia.Domain.Models.Mapping
{
    public class TonKhoMap : EntityTypeConfiguration<TonKho>
    {
        public TonKhoMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            // Table & Column Mappings
            this.ToTable("TonKho");
            this.Property(t => t.idsanpham).HasColumnName("idsanpham");
            this.Property(t => t.ngaytk).HasColumnName("ngaytk");
            this.Property(t => t.soluongtk).HasColumnName("soluongtk");
            this.Property(t => t.soluongnhap).HasColumnName("soluongnhap");
            this.Property(t => t.soluongban).HasColumnName("soluongban");
            this.Property(t => t.id).HasColumnName("id");

            // Relationships
            this.HasRequired(t => t.SanPham)
                .WithMany(t => t.TonKhoes)
                .HasForeignKey(d => d.idsanpham);
            this.HasRequired(t => t.SanPham1)
                .WithMany(t => t.TonKhoes1)
                .HasForeignKey(d => d.idsanpham);

        }
    }
}
